/**
 * 
 */
package org.cashbook.core.objects.transaction;

import java.util.ArrayList;
import java.util.Set;

/**
 * @author Jascha
 * 
 * Overview of all transactions for a specific month.
 */
public interface ITransactionOverview {
	
	public final static String JANUARY = "JANUARY";
	public final static String FEBRUARY = "FEBRUARY";
	public final static String MARCH = "MARCH";
	public final static String APRIL = "APRIL";
	public final static String MAY = "MAY";
	public final static String JUNE = "JUNE";
	public final static String JULY = "JULY";
	public final static String AUGUST = "AUGUST";
	public final static String SEPTEMBER = "SEPTEMBER";
	public final static String OCTOBER = "OCTOBER";
	public final static String NOVEMBER = "NOVEMBER";
	public final static String DECEMBER = "DECEMBER";
	
	/**
	 * Adds a new transaction to specific period
	 * @param transaction
	 */
	public void addTransaction(ITransaction transaction);
	
	/**
	 * Returns a specific transaction of this period
	 * @param transactionID ID to specify a transaction
	 * @return
	 */
	public ITransaction getTransaction(int transactionID);
	
	/**
	 * Delete a specific transaction
	 * @param transactionID
	 */
	public void deleteTransaction(int transactionID);
	
	/**
	 * Returns the month of the transaction overview instance
	 * @return
	 */
	public String getMonth();
	
	/**
	 * Returns the year of the transaction overview instance
	 * @return
	 */
	public int getYear();
	
	/**
	 * Returns an arraylist with all transactions of the specified month
	 * @param account Specifies the account the transactions belong to
	 * @return Arraylist of transactions
	 */
	public ArrayList<ITransaction> getTransactions(String account);
	
	/**
	 * Returns the month's opening balance
	 * @return
	 */
	public double getOpeningBalance();
	
	/**
	 * Returns the month's approximate closing balance
	 * @return
	 */
	public double getClosingBalance();
	
	/**
	 * Returns the sum of all earnings that occur in this month
	 * @return
	 */
	public double getSumEarnings();
	
	/**
	 * Returns the sum of all expenses that occur in this month
	 * @return
	 */
	public double getSumExpenses();
	
	/**
	 * Returns the difference of all earnings and all expenses in this month
	 * @return
	 */
	public double getDifference();
	
	/**
	 * Returns the total value of the selected transactions
	 * @param transactions Set of transactions the total sum shall be calculated for
	 * @return
	 */
	public double SumSelectedTransactions(Set<ITransaction> transactions);
	
	/**
	 * Returns the overall balance on a specific day in this month
	 * @param day
	 * @return
	 */
	public double BalanceAt(Integer day);
	
	public boolean bufferUptodate();
	
	public void updateBuffer();

}
